import http from '@/utils/request'
// 登录方法
export async function login(data) {
  return await http.login("/api/user/login",data)
}
// 获取登陆用户信息
export async function getInfo() {
  return await http.get("/api/sysUser/getInfo")
}

// 退出登录
export async function logout(param) {
  return await http.post("/api/sysUser/logout",param)
}
// 获取菜单数据
export async function getMenuList(){
  return await http.get("/api/sysUser/getMenuList");
}
 // 刷新token
export async function refreshTokenApi(params){
  return await http.post("/api/sysUser/refreshToken",params);
}
export default{
  async getUserAll(param){
    return await http.get("/api/user/listAll",param)
  },
  async getUserList(params){
    return await http.get("/api/user/list",params)
  },
  async addUser(params){
    return await http.post("/api/user/add",params)
  },
  async updateUser(params){
    return await http.put("/api/user/update",params)
  },
  async deleteUserById(param){
    return await http.delete("/api/user/delete",param)
  },
  async getRoleList(params){
    return await http.get("/api/user/getRoleList",params)
  },
  async getRoleByUserId(param){
    return await http.getRestApi("/api/user/getRoleByUserId",param)
  },
  // 分配角色
  async assignRoleSave(params){
    return await http.post("/api/user/saveUserRole",params)
  },
  // 根据角色id查用户
  async findUserByRoleId(param){
    return await http.get("/api/user/findUserByRoleId",param)
  },
  // 修改密码
  async updatePassword(params){
    return await http.put("/api/user/updatePassword",params)
  },
  //修改信息
  async register(param){
    return await http.put("/api/user/register",param)
  }
}